<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <link rel="stylesheet" href="../../assets/css/base.css">
  <style>
    .top {
      height: 50vh;
      background-image: linear-gradient(black, white);
    }

    .sticky {
      /*
        粘性定位
         ● 能在视口完全显示时，显示特点同 relative
         ● 不能在视口完全显示时，显示特点同 fixed
       */
      position: sticky;
      top: 0;

      height: 100px;
      background-color: #17f;
    }

    .bottom {
      height: 200vh;
      background-image: linear-gradient(white, black);
    }
  </style>
</head>

<body>
  <div class="top"></div>
  <div class="sticky"></div>
  <div class="bottom"></div>
</body>

</html>